]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: do not show empty categories
authorStéphane Démurget <stephane.demurget@free.fr>
Fri, 16 Nov 2012 07:22:58 +0000 (08:22 +0100)
committerStéphane Démurget <stephane.demurget@free.fr>
Tue, 20 Nov 2012 20:17:57 +0000 (21:17 +0100)
Desktop files can specify if the application should only be shown for
specified desktops with OnlyShowIn and NotShowIn directives options.

If a menu category only contained entries for a different desktop, we
were still creating the category.

We now only add a category button if there is at least one application
to be displayed in this category.

https://bugzilla.gnome.org/show_bug.cgi?id=687970

js/ui/appDisplay.js

index 803b7d788d28608b7e5eb4b8eedac72e773fd5f7..300c7e75a722c94cc64aff5c2c24ca6bbdb91c95 100644 (file)
@@ -216,6 +216,16 @@ const ViewByCategories = new Lang.Class({
     },
 
     _addCategory: function(name, index, dir) {
+        let apps;
+
+        if (dir != null) {
+            apps = [];
+            this._loadCategory(dir, apps);
+
+            if (apps.length == 0)
+                return;
+        }
+
         let button = new St.Button({ label: GLib.markup_escape_text (name, -1),
                                      style_class: 'app-filter',
                                      x_align: St.Align.START,
@@ -225,12 +235,9 @@ const ViewByCategories = new Lang.Class({
             this._selectCategory(index);
         }));
 
-        var apps;
         if (dir == null) {
             this._allCategoryButton = button;
         } else {
-            apps = [];
-            this._loadCategory(dir, apps);
             this._categories.push({ apps: apps,
                                     name: name,
                                     button: button });